import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-09-28
 * Time: 23:09
 */
public class Exam928 {
    public static int StrToInt(String str) {
        int flag = 1;
        int ans = 0;
        int count = 0;
        for (int i = str.length() - 1; i >= 0; i--) {
            char c = str.charAt(i);
            if(!Character.isDigit(c)) {
                if(i != 0) {
                    return 0;
                } else if(c != '+' && c != '-') {
                    return 0;
                } else if(c == '-') {
                    flag = -1;
                    continue;
                } else if(c == '+') {
                    flag = 1;
                    continue;
                }
            }
            ans += (c - '0') * Math.pow(10, count++);
        }
        return ans * flag;
    }
    public static int dfs(int[][] arr, int a, int b, int count) {
        if(a > h || b > w || a <= 0 || b <= 0) {
            return count;
        }
        if(arr[a][b] == 0) {
            arr[a][b] = 1;
            if(arr[a - 1][b - 1] == 1 || arr[a - 1][b + 1] == 1
                    || arr[a + 1][b - 1] == 1 || arr[a + 1][b + 1] == 1) {
                arr[a][b] = 0;
                return count;
            } else {
                int m = dfs(arr, a + 1, b, count + 1);
                int n = dfs(arr, a - 1, b, count + 1);
                int p = dfs(arr, a, b - 1, count + 1);
                int q = dfs(arr, a, b - 1, count + 1);

                int max1 = Math.max(m, n);
                int max2 = Math.max(p, q);
                return Math.max(max1, max2);
            }
        } else {
            return count;
        }

    }
    static int w;
    static int h;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        w = scanner.nextInt();
        h = scanner.nextInt();
        int[][] arr = new int[h + 2][w + 2];
        int ans = dfs(arr, 1, 1, 0);
        System.out.println(ans);
    }
}
